// 适合纯11位手机
const splitMobile = (mobile, format = "-") => {
  return String(mobile).replace(/(?=(\d{4})+$)/g, format);
};
// 适合11位以内的分割
const splitMobile2 = (mobile, format = "-") => {
  return String(mobile)
    .replace(/(?<=(\d{3}))/, format)
    .replace(/(?<=([\d\-]{8}))/, format);
};

console.log(splitMobile(18379802267)); // 183-7980-2267
console.log(splitMobile2(18379876545)); // 183-7987-6545
console.log(splitMobile2(5013409)); // 183-7987-6545
